package com.lc.cehui.ui.activity.home;

import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

import com.hjq.bar.TitleBar;
import com.hjq.http.EasyHttp;
import com.hjq.http.listener.HttpCallback;
import com.lc.cehui.R;
import com.lc.cehui.app.AppActivity;
import com.lc.cehui.http.request.ShowApi;
import com.lc.cehui.http.response.ShowBean;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MessageDetailActivity extends AppActivity {
    @BindView(R.id.titlebar)
    TitleBar titlebar;
    @BindView(R.id.text)
    TextView text;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_message_details;
    }

    @Override
    protected void initView() {

        show();

    }

    private void show() {
        EasyHttp.post(this)
                .api(new ShowApi().setNotice_id(getIntent().getStringExtra("notice_id")))
                .request(new HttpCallback<ShowBean>(this) {

                    @Override
                    public void onSucceed(ShowBean data) {
                        toast(data.getMsg());
                        if (data.getCode().equals("200")) {
                                 titlebar.setTitle(data.getData().getTitle());
                                 text.setText(Html.fromHtml(data.getData().getContent()));

                        }

                    }
                });
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
